<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <title>绑定商户</title>
    <link rel="icon" href="favicon.ico" type="image/x-icon"/>
    <!-- 当前页面样式 -->
    <link rel="stylesheet" href="<s:url value="/css/common.css"/>"/>
    <!-- 当前页面样式 END -->
    <script type="text/javascript" src="<c:url value="/js/jquery-1.3.2.js" />"></script>
	<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
	<script type="text/javascript" src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
	<script type='text/javascript' src='<s:url value="/js/pageAjax.js"/>'></script>
	<script type='text/javascript' src='<s:url value="/dwr/engine.js"/>'></script>
	<script type='text/javascript' src='<s:url value="/dwr/interface/MccQuery.js"/>'></script>
	<script type='text/javascript' src='<s:url value="/js/querySon.js"/>'></script>
	<script type="text/javascript">
	
	
	function queryForm(obj){
		var mchtCd = $.trim($("#mchtCd").val());
		if(mchtCd == '' || mchtCd==null){
			alert("商户号不能为空");
			return;
		}
		
		$("#"+obj.id).attr("disabled",true);
		$("#queryUserForm").attr("action",'<s:url value="/bindMerinfo/queryBindList.ct"/>');
		$("#queryUserForm").submit();		
	}
	
	function bindMerchant(str,bindTermId){
		var beforeMchtcd = $.trim($("#beforeMchtcd").val());
		var beforeTermId = $.trim($("#beforeTermId").val());
		
		if(str == beforeMchtcd){
			alert("商户号【"+str+"】不能作为后端商户号被绑定");
			return;
		}
		
		//alert(str+","+bindTermId+","+beforeMchtcd+","+beforeTermId);
		
		if(confirm("确定要给前端商户号【"+beforeMchtcd+"】绑定后端商户号【"+str+"】吗？")){
    		$.ajax({
    			type:"post",
    			url:"bindMerchant.ct",
    			data:{"bindMerOper.beforeMchtcd":beforeMchtcd,"bindMerOper.beforeTermId":beforeTermId,"bindMerOper.bindMchtCd":str,"bindMerOper.bindTermId":bindTermId},
    			dataType:"json",
    			success:function(result){
    				alert(result.resMap.msg);
    				if(result.resMap.flag){
    					window.location.href="<%=basePath%>/bindMerinfo/jspInit.ct";
    				}
    				
    			},error:function(){
    				
    			}
    			
    		});
    	}
		
	}
	
	
	function back(){
		window.location.href="<%=basePath%>/bindMerinfo/jspInit.ct";
	}
	
</script>
</head>
<body>
<s:form id="queryUserForm" action="" method="post" theme="simple">
<s:hidden id="beforeMchtcd" value="%{#request.beforeMchtcd}" name="beforeMchtcd"/>
<s:hidden id="beforeTermId" value="%{#request.beforeTermId}" name="beforeTermId"/>
<table class="tb">
    <tbody>
        <tr class="tb-line">
            <td class="tb-td" colspan="4"><div class="tb-h2">POS收单运营管理平台</div></td>
        </tr>

        <tr class="tb-line">
            <td class="tb-td" colspan="4"><div class="tb-h3">绑定商户查询</div></td>
        </tr>
 
       <tr class="tb-line">
            <td align="right" class="tb-td">
                <div class="tb-h4">商户号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield  name="bindMerParams.mchtCd"  id="mchtCd"/>
               	</label>
            </td>
             <td align="right" class="tb-td">
                <div class="tb-h4">商户简称：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield  name="bindMerParams.nameBusi" maxlength="20"/>
                </label>
            </td>
        </tr>

        <tr class="tb-line">
            <td align="right" class="tb-td">
                <div class="tb-h4">终端号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:textfield  name="bindMerParams.termId" maxlength="25"/>
                </label>
            </td>
            <td align="right" class="tb-td">入网时间：</td>
			<td class="tb-td" >
				 <label class="tb-input-normal">
					<s:textfield    onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,wdate:true,errDealMode:0});"    name="bindMerParams.minDate"  />
				 </label>
				-
				 <label class="tb-input-normal">
					<s:textfield  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,wdate:true,errDealMode:0});"   name="bindMerParams.maxDate"   />
				</label>
			</td>
        </tr>
		
        
        
        
		
		
        <tr class="tb-line">
            <td class="tb-td line-submit" align="right" colspan="4">
                <label class="tb-input-submit">
                    <input type="button" value="查询" id="queryBtn" onclick="queryForm(this)"/>
                </label>
                <label class="tb-input-submit">
                    <input type="reset" value="取消"/>
                </label>
                <label class="tb-input-submit">
                    <input type="button" value="返回" id="backBtn" onclick="back()"/>
                </label>
                
            </td>
        </tr>
         <tr class="tb-line">
         		<td class="tb-td line-submit" align="center" colspan="4">
         			<font color="red" id="msgInfo"><s:actionmessage/>
         				<s:if test="#request.COUNT != null">
		               	统计：当前查询条件共计[<font color="red"><s:property value="#request.COUNT"/></font>]条数据
		               	</s:if>
         			</font>
         		</td>
         </tr>
        <s:if test="#request.searchRsList != null && #request.searchRsList.size>0 ">
			<tr class="tb-line">
				<td class="tb-td paging"  align="left" colspan="4"> 
					 	<page:pageCount max_pages="11" totalPage="${requestScope.totalPage}"
						currentPage="${requestScope.currentPage}"
						action="${rootPath}/bindMerinfo/queryBindList.ct?currentPage=" />

				</td>
			</tr>
		</s:if>
    </tbody>
</table>
</s:form>
<div class="big-tb">
    <table class="tb" style="width: 150%;">
        <thead>
            <tr class="tb-line">
				 <th class="tb-th" colspan="26">商户基本信息列表</th>
            </tr>
            <tr class="tb-line bg-gray">
				<th class="tb-th">商户号</th>
				<th class="tb-th">商户简称</th>
				<th class="tb-th">营业名称</th>
				<th class="tb-th">终端号</th>
				<th class="tb-th">SN</th>
				<th class="tb-th">商户类别</th>
				<th class="tb-th">所属机构</th>
				<!-- <th class="tb-th">所属分公司</th> -->
				<!-- <th class="tb-th">所属代理商</th> -->
				<!-- <th class="tb-th">直属代理商</th> -->
				<th class="tb-th">审核人员</th>
				<th class="tb-th">审核日期</th>
				<th class="tb-th">状态</th>
				<th class="tb-th">业务联系人</th>
				<th class="tb-th">业务联系人电话</th>
				<th class="tb-th">法人</th>
				<th class="tb-th">法人证件号</th>
				
				<th class="tb-th">结算银行</th>
				<th class="tb-th">联行号</th>
				<th class="tb-th">结算银行账号名称</th>
				<th class="tb-th">结算银行账号</th>
				<th class="tb-th">商户地址</th>
				<th class="tb-th">营业执照号</th>
				
				
				
				<th class="tb-th">操作</th>
            </tr>
        </thead>
        <tbody>
			<s:iterator value="#request.searchRsList" status="stat" id="sh">
				<tr class="tb-line" >
					<td class="tb-td">
						<s:property value="#sh.mid"/>
					</td>
					<td class="tb-td"><s:property value="#sh.merName"/></td>
			        <td class="tb-td"><s:property value="#sh.merBrName"/></td>
			        <td class="tb-td"><s:property value="#sh.termId"/></td>
			        <td class="tb-td"><s:property value="#sh.sn"/></td>
			        
			       <td class="tb-td">
			       	 
			        	<s:if test="#sh.nationCd==\"0\"">个体户</s:if>
			        	<s:if test="#sh.nationCd==\"1\"">企业</s:if>
			        </td>
			        <td class="tb-td"><s:property value="#sh.merKind"/> </td>
			        <%-- <td class="tb-td">
	        				<s:if test="#sh.companyName ==null || #sh.companyName==''">暂无</s:if>
	        				<s:else><s:property value="#sh.companyName"/></s:else>
			         </td> --%>
			         <%-- <td class="tb-td">
			         	<s:if test="#sh.oneAgentName ==null || #sh.oneAgentName==''">暂无</s:if>
	        			<s:else><s:property value="#sh.oneAgentName"/></s:else>
			         </td> --%>
			         <%-- <td class="tb-td">
			         	<s:if test="#sh.agentId ==null || #sh.agentId==''">暂无</s:if>
	        			<s:else><s:property value="#sh.agentId"/></s:else>
			         </td> --%>
			        <td class="tb-td">
			        	<s:if test="#sh.bus_lic == \"\"">陈静
			        	</s:if>
			        	<s:else>
			        		<s:property value="#sh.bus_lic"/> 
			        	</s:else>
			        </td>
			        <td class="tb-td">
			        <s:property value="#sh.applDate"/> 
			        </td>
			        <td class="tb-td"><font id="s_<s:property value="#sh.mid"/>"><s:property value="#sh.flag"/></font></td>
			        <td class="tb-td"><s:property value="#sh.perName"/></td>
			        <td class="tb-td"><s:property value="#sh.perPhone"/></td>
			        <td class="tb-td"><s:property value="#sh.interContact"/></td>
			        <td class="tb-td"><s:property value="#sh.cardNo"/></td>
				    
			        <td class="tb-td"><s:property value="#sh.amount1"/></td>
			        <td class="tb-td"><s:property value="#sh.amount2"/></td>
			        <td class="tb-td"><s:property value="#sh.rsvl"/></td>
			        <td class="tb-td"><s:property value="#sh.rsvl3"/></td>
			        <td class="tb-td"><s:property value="#sh.addr"/></td>
			        <td class="tb-td"><s:property value="#sh.flagCode"/></td>
				    
			        
			       
			        <td class="tb-td"><a href="javascript:bindMerchant('<s:property value="#sh.mid"/>','<s:property value="#sh.termId"/>')" class="blue"><b><font color="green">绑定</font></b></a></td>
			      </tr>
			</s:iterator>		
        </tbody>
    </table>
   
</div>
 <s:if test="#request.msg !=null">
		<script language="javascript">
			alert("${request.msg}");
		</script>
	</s:if>
</body>
</html>